<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="pageTag" uri="/WEB-INF/tld/pageTag.tld"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" language="javascript" src="${r'${pageContext.request.contextPath}'}/resources/js/pageTag/page.js"></script>
<script type="text/javascript" language="javascript" src="${r'${pageContext.request.contextPath}'}/resources/js/layer/layer.js"></script>
</head>
<body>
<form id="mainForm" action="${r'${pageContext.request.contextPath}'}/${className?uncap_first}/list.htm" method="post">

<div class="input-group col-lg-2">
      <input type="text" name="sec" class="form-control" placeholder="Search for...">
      <span class="input-group-btn">
        <button class="btn btn-default" type="submit">查询</button>
      </span>
    </div>
<button class="btn btn-default" type="button" onclick="openwindow('新增','${r'${pageContext.request.contextPath}'}/forward.htm?page=edit_${className}_view')" >新增</button>
	<table class="table table-striped table-bordered">
		<thead>
			<tr>
				<#list attrs as a> 
			    	<th>${a.columnComment!}</th>
			    </#list>
			    <th></th>
			</tr>
		</thead>
		<c:forEach items="${r'${'}${className}${r's}'}" var="obj">
			<tr>
				<#list attrs as a> 
			    	<td>${r'${obj.'}${a.columnName!}${r'}'}</td>
			    </#list>
			    <td>
			    <#list attrs as a><#if a.primary?contains("TRUE")>
			    	<a onclick="openwindow('查看','${r'${pageContext.request.contextPath}'}/${className?uncap_first}/getId.htm?a=v&${a.columnName!}=${r'${obj.'}${a.columnName!}${r'}'}')" href="#">查看</a>
			    	<a onclick="openwindow('编辑','${r'${pageContext.request.contextPath}'}/${className?uncap_first}/getId.htm?a=e&${a.columnName!}=${r'${obj.'}${a.columnName!}${r'}'}')" href="#">编辑</a>
			    </#if></#list>
			    </td>
			</tr>
		</c:forEach>
		<pageTag:page curPage="${r'${'}${className?uncap_first}${r'.page}'}" totalPages="${r'${'}${className?uncap_first}${r'.total/'}${className?uncap_first}${r'.limit }'}" totalRecords="${r'${'}${className?uncap_first}${r'.total }'}" />
		<input type="hidden" name="page" id="page" value="${r'${'}${className?uncap_first}${r'.page}'}"/>
	</table>
</form>
</body>
<script type="text/javascript">
function openwindow(title,url){
		layer.open({
		    type: 2,
		    title: title,
		    maxmin: true,
		    area: ['600px', '400px'],
		    content: url
		  });
	}
</script>
</html>